home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / XAMPP 1.4.14 / xampp-win32-1.4.14-installer.exe / xampp / php / pear / adodb / tests / test-perf.php < prev    next >
PHP Script  |  2003-10-08  |  959b  |  51 lines

  1. <?php
  2.  
  3. include_once('../adodb-perf.inc.php');
  4.  
  5. error_reporting(E_ALL);
  6. session_start();
  7.  
  8. if (isset($_GET)) {
  9.     foreach($_GET as $k => $v) {
  10.         if (strncmp($k,'test',4) == 0) $_SESSION['_db'] = $k;
  11.     }
  12.  
  13. if (isset($_SESSION['_db'])) {
  14.     $_db = $_SESSION['_db'];
  15.     $_GET[$_db] = 1;
  16.     $$_db = 1;
  17. }
  18.  
  19. echo "<h1>Performance Monitoring</h1>";
  20. include_once('testdatabases.inc.php');
  21.  
  22.  
  23. function testdb($db) 
  24. {
  25.     if (!$db) return;
  26.     echo "<font size=1>";print_r($db->ServerInfo()); echo " user=".$db->user."</font>";
  27.     
  28.     $perf = NewPerfMonitor($db); 
  29.     
  30.     # unit tests
  31.     if (0) {
  32.         //$DB->debug=1;
  33.         echo "Data Cache Size=".$perf->DBParameter('data cache size').'<p>';
  34.         echo $perf->HealthCheck();
  35.         echo($perf->SuspiciousSQL());
  36.         echo($perf->ExpensiveSQL());
  37.         echo($perf->InvalidSQL());
  38.         echo $perf->Tables();
  39.     
  40.         echo "<pre>";
  41.         echo $perf->HealthCheckCLI();
  42.         $perf->Poll(3);
  43.         die();
  44.     }
  45.     
  46.     if ($perf) $perf->UI(3);
  47. }
  48.  
  49. ?>
  50.